
def in_group(user, group_name):
    return group_name in user.groups.values_list('name', flat=True)
